package com.thy.controller;

import com.hospital.common.base.PageResult;
import com.hospital.common.base.Result;
import com.hospital.common.dto.management.module.PatientQueryDto;
import com.hospital.common.vo.management.module.PatientInfoVo;
import com.thy.service.TPatientInfoService;
import com.thy.service.TUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 后台统计相关接口
 */
@RestController
@RequestMapping("/statForBackend")
public class StatForBackendController {
    @Autowired
    private TUserService tUserService;
    @Autowired
    private TPatientInfoService tPatientInfoService;

    /**
     * 获取所有患者数量
     */
    @GetMapping("/getAllPatientCount")
    public Result<Long> getAllPatientCount() {
        return Result.success(tUserService.allPatientCount());
    }

    /**
     * 获取所有医生数量
     */
    @GetMapping("/getAllDoctorCount")
    public Result<Long> getAllDoctorCount() {
        return Result.success(tUserService.allDoctorCount());
    }

    /**
     * 分页获取患者信息
     */
    @PostMapping("/queryPatientInPage")
    public Result<PageResult<PatientInfoVo>> queryPatientInPage(@RequestBody PatientQueryDto patientQueryDto) {
        return Result.success(tPatientInfoService.query(patientQueryDto));
    }

}
